import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CostVO, CostForm, CostQuery } from '@/api/business/parkingLotCost/types';

/**
 * 查询车库费用列表
 * @param query
 * @returns {*}
 */

export const listCost = (query?: CostQuery): AxiosPromise<CostVO[]> => {
  return request({
    url: '/business/cost/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询车库费用详细
 * @param garageCostId
 */
export const getCost = (garageCostId: string | number): AxiosPromise<CostVO> => {
  return request({
    url: '/business/cost/' + garageCostId,
    method: 'get'
  });
};

/**
 * 新增车库费用
 * @param data
 */
export const addCost = (data: CostForm) => {
  return request({
    url: '/business/cost',
    method: 'post',
    data: data
  });
};

/**
 * 修改车库费用
 * @param data
 */
export const updateCost = (data: CostForm) => {
  return request({
    url: '/business/cost',
    method: 'put',
    data: data
  });
};

/**
 * 删除车库费用
 * @param garageCostId
 */
export const delCost = (garageCostId: string | number | Array<string | number>) => {
  return request({
    url: '/business/cost/' + garageCostId,
    method: 'delete'
  });
};
